<template>
  <h1>1.组件的基本写法</h1>
  <button @click="addCount">修改count的值{{count}}</button>
</template>

<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  name: "About",
});
</script>

<script setup lang="ts">
  import {ref,watch} from 'vue'
  let count = ref(0)
  const addCount = () => {
    count.value++
  }
  watch(count,(newVal,oldVal) => {
      console.log('监听触发了',newVal,oldVal);
  },{immediate:true})
</script>